package com.wkck.controller.frontend;

import com.wkck.VO.CheckUserDeliveredVo;
import com.wkck.dto.UserDeliverResumeInfoDto;
import com.wkck.result.Result;
import com.wkck.service.LResumeDeliveredService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: CK
 * @Date: 2024/03/15/23:48
 * @Description:
 */
@Slf4j
@CrossOrigin
@Api(value = "用户简历api",tags = "用户简历api")
@RestController
@RequestMapping("/user/deliver")
public class LResumeDeliveredFrontendController {

    @Autowired
    private LResumeDeliveredService deliveredService;

    /***
    * @Author: CK
    * @Date: 2024/3/15
    * @Param: [dto]
    * @Description: 用户投递简历
    */
    @PostMapping("/send")
    @ApiOperation(value = "用户投递简历")
    public Result<Boolean> userDeliverResume(@RequestBody UserDeliverResumeInfoDto dto) {
        log.info("用户投递简历 =====> {}", dto);
        return Result.success(deliveredService.userDeliverResume(dto));
    }

    /***
    * @Author: CK
    * @Date: 2024/3/16
    * @Param: [career_id, user_id]
    * @Description: 检查用户是否在该职位已投递过简历
    */
    @GetMapping("/check/{career_id}/{user_id}")
    @ApiOperation(value = "检查用户是否在该职位已投递过简历")
    public Result<CheckUserDeliveredVo> checkUserDeliveredResumeForCareer(@PathVariable("career_id") Long career_id, @PathVariable("user_id") Integer user_id) {
        log.info("检查用户：{}是否在该职位：{}已投递过简历", user_id, career_id);
        return Result.success(deliveredService.checkUserDeliveredResumeForCareer(career_id, user_id));
    }

}
